
package org.vectrics.swing;


import java.awt.Color;
import java.awt.SystemColor;
import java.awt.Font;
import java.awt.Dimension;
import javax.swing.JButton;
import javax.swing.border.EtchedBorder;
import javax.swing.border.Border;
import javax.swing.border.BevelBorder;
import javax.swing.*;
import java.awt.*;


public class GuiManager {
	static private GuiManager instance = null;
	private static Color BACKGROUND_COLOR = SystemColor.control;
	private static Font FIELD_FONT = new java.awt.Font("Helvitica", 0, 11);
	private static Font FIELD_BOLD_FONT = new java.awt.Font("Helvetica Bold", Font.BOLD, 11);
	
	public GuiManager() {
		super();
		instance = this;
	}
	
	static public GuiManager getInstance() {
		if (instance == null) {
			//throw new NoProviderException("A GuiManager was not instantiated before requesting instance");
			instance = new GuiManager();
		}
		return(instance);
	}


	public Color getBackgroundColor() {
		return(BACKGROUND_COLOR);
	}
	
	public Font getStandardFont() {
		return(FIELD_FONT);
	}

	public Font getStandardBoldFont() {
		
		return(FIELD_BOLD_FONT);
	}

	public JButton createButton(String text) {
		return(createButton(text, 90, 20));
	}
	
	public JButton createButton(String text, int width, int height) {
			JButton button = new JButton();	
		button.setText(text);
		button.setFont(getStandardFont());
		button.setMinimumSize(new Dimension(width, height));
		button.setMaximumSize(new Dimension(width, height));
		button.setPreferredSize(new Dimension(width, height));
		return(button);
	}
	
	
	public JTabbedPane createTabbedPane() {
		JTabbedPane tabbedPane = new JTabbedPane();
		tabbedPane.setFont(this.getStandardFont());
		return(tabbedPane);
	}
	
	public Border getEtchedBorder() {
		return(new EtchedBorder());
	}	
	
	public Border getSunkenBorder() {
		Border border = new BevelBorder(BevelBorder.LOWERED);
		return(border);
	}	
	
	public Image getErrorPanelImage() {
		ImageIcon icon = new ImageIcon("error.gif");
		return(icon.getImage());
	}
	
}

	

